<!--
 * @Author: Qimu
 * @Date: 2020-04-25 06:40:21
 * @LastEditors: Qimu
 * @LastEditTime: 2020-06-30 01:03:29
 * @Description: file content
 * @FilePath: \vue-admin-koa2\vue-admin\src\components\Dialogs\EditCategory.vue
 -->
<template>
  <div class="ArticleCategory">
    <!-- 编辑文章分类 start-->
    <el-dialog
      title="编辑文章分类"
      :visible.sync="editArticleCategoryFormCom.editArticleCategoryDialogVisible"
      width="20%"
    >
      <!-- :rules="editArticleCategoryFormRules" -->
      <el-form
        class="editArticleCategoryForm"
        :model="editArticleCategoryFormCom.editArticleCategoryForm"
        ref="editArticleCategoryFormRef"
        size="mini"
        label-width="100px"
      >
        <el-form-item label="分类名称" prop="ArticleCategory_name">
          <el-input
            v-model="editArticleCategoryFormCom.editArticleCategoryForm.category_name"
          ></el-input>
        </el-form-item>
        <el-form-item label="分类简述" prop="ArticleCategory_sketch">
          <el-input
            type="textarea"
            v-model="editArticleCategoryFormCom.editArticleCategoryForm.category_sketch"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          @click="editArticleCategoryFormCom.editArticleCategoryDialogVisible = false"
          size="mini"
        >取 消</el-button>
        <el-button type="primary" @click="confirmEditArticleCategory" size="mini">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 编辑文章分类 end-->
  </div>
</template>

<script>
export default {
  name: 'EditArticleCategory',
  props: {
    editArticleCategoryFormCom: {
      type: Object,
      required: true
    }
  },
  methods: {
    //编辑文章分类对话框的提交事件
    confirmEditArticleCategory() {
      const data = {
        _id: this.editArticleCategoryFormCom.editArticleCategoryForm._id,
        category_name: this.editArticleCategoryFormCom
          .editArticleCategoryForm.category_name,
        category_sketch: this.editArticleCategoryFormCom
          .editArticleCategoryForm.category_sketch
      }
      this.$emit('confirmEditArticleCategory', data) //向父组件ArticleCategory.vue传值
      this.editArticleCategoryFormCom.editArticleCategoryDialogVisible = false //关闭编辑文章分类对话框
    }
  }
}
</script>

<style lang="sass" scope>
.editArticleCategoryForm
  .el-input
    width: 150px
</style>